import 'package:flutter/material.dart';

class GameIcon extends StatelessWidget {
  
  const GameIcon({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(8),
      margin: const EdgeInsets.fromLTRB(8, 8, 0, 8),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
        boxShadow: [
          BoxShadow(
            color: Colors.grey.withOpacity(0.5),
            spreadRadius: 2,
            blurRadius: 5,
            offset: const Offset(0, 1),
          ),
        ],
      ),
      child: Stack(
            children: [
              ClipRRect(
                borderRadius: BorderRadius.circular(10),
                child: Image.network(
                  'http://192.168.1.185/2.jpg',
                  width: 80,
                  height: 110,
                  fit: BoxFit.cover,
                ),
              ),
              Positioned(
                bottom: 0,
                left: 0,
                right: 0,
                child: Container(
                  height: 30,
                  decoration: const BoxDecoration(
                    color: Colors.blue,
                    borderRadius: BorderRadius.only(
                      bottomLeft: Radius.circular(10),
                      bottomRight: Radius.circular(10),
                    ),
                  ),
                  child: const Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        'Line 1',
                        style: TextStyle(color: Colors.white,fontSize: 8),
                      ),
                      Text(
                        'Line 2',
                        style: TextStyle(color: Colors.white,fontSize: 8),
                      ),
                    ],
                  ),
                ),
              ),
            
            ],
        ) ,
          
    );
  }
}


class GameIconList extends StatelessWidget{
  const GameIconList({super.key}); 


  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      height: 150,
      child: ListView.builder(
        scrollDirection: Axis.horizontal,
        
        // physics: const BouncingScrollPhysics(), //添加一点惯性移动效果
        itemCount: 10,
        itemBuilder: (context, index) {
            return const GameIcon();
        },
      ),
    );
  }
}

